var authorityAdd = {
	authorityId: null,
	flag : false
};

$(function(){
	changeActiveItem('authorityList');
	savehandle();
});
/**
 * 提示信息处理
 */
function savehandle(){
	$("#alertdiv").hide();
	$('#alertdiv').savehandle({
		fieldMap:{rigth:'权限'},
		successMsg: '提交成功！',
		failMsg: '提交失败，请重试！错误：',
		success:successCallBack
	});
}
/**
 * 权限添加成功跳转
 */
function successCallBack(){
	location.href = 'authorityList.jsp';
}

/**
 * 提交数据
 * @return {TypeName} 
 */
function add(){
	var authority = $('#authorityAdd #authorityAddForm #authority').val();

	//验证权限
	var authority = $('#authorityAdd .content #authority').val();
	//验证登录用户名
	var userName = $('#authorityAdd .content #userName').val();
	//验证用户登录密码
	var password = $('#authorityAdd .content #password').val();

	//获取基本信息
	var datas = {
		authority: authority,

		"user.userName":userName,
		"user.password":password
	};
	for(var o in datas){
		if(!datas[o] && "0" != datas[o])
			delete(datas[o]);
	}
	if(!$('#authorityAddForm').validate()){
		$('#alertdiv').savehandle('setmsg',{msg:'请完善输入信息!',timer:2000});
		return;
	}
	$.getJSON(
		'/fw/auth/authority_add.action',
		datas,
		function(data){
			$('#alertdiv').savehandle('handle',data,2000);
		} 
	);
}


/**
 * 重写reSet函数
 */
function reSet() {
	$('#authorityAdd #authorityAddForm #authority').val('');
}

